ToolExecutionContext

class ToolExecutionContext<TContext>(val context: TContext?, val abortSignal: AbortSignal, val stepNumber: Int, val messages: List<ModelMessage>, val toolCallId: String, val writer: ToolStreamWriter = NoopToolStreamWriter)

What Tool.executor sees as this. Holds the typed application context (whatever the agent's callOptionsSchema says) plus the abort signal (invariant I-10: subagent tool handlers MUST forward this), the current step number, and the running message list.

Constructors

Link copied to clipboard
constructor(context: TContext?, abortSignal: AbortSignal, stepNumber: Int, messages: List<ModelMessage>, toolCallId: String, writer: ToolStreamWriter = NoopToolStreamWriter)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The current tool call's id. Mirrors v6's ToolExecutionOptions.toolCallId. Lets a tool self-identify for tracing, telemetry, or streaming-progress writes (paired with writer).

Link copied to clipboard

Writes custom events into the agent's active output stream (gap #21). The loop supplies a real writer bound to the output flow; defaults to NoopToolStreamWriter when a context is constructed outside the loop.